package com.shujia.list_;

import java.util.Stack;

public class StackDemo {

    public static void main(String[] args) {
        // 先进后出, 其实就是访问受限的Vector
        Stack stack = new Stack();

        System.out.println(stack.empty());

        stack.push(10);
        stack.push(20);
        stack.push("aa");
        stack.push("bb");

        System.out.println(stack);

        System.out.println(stack.peek());
        System.out.println(stack.peek());

        System.out.println("-------------");
        System.out.println(stack.search("bb"));
        System.out.println(stack.search(10));


        System.out.println("-------------");
        while (!stack.empty()) {
            System.out.println(stack.pop());
        }




    }
}
